<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../vue.js"></script>
</head>

<body>
  <div id="app">

    <ul>
      <li v-for="(item,index) in cities" v-if="item.id % 2 === 1" v-bind:key="item.id">
        {{item.name}}-{{index}}
      </li>
    </ul>
    <hr>





  </div>

  <script>

    var vm = new Vue({
      el: "#app",
      data: {
        cities: [{ name: '北京', id: 1 }, { name: "天津", id: 2 }, { name: "上海", id: 3 }]
      }
    })

  </script>

</body>

</html>